using System;
using System.Linq.Expressions;

namespace MathService.Expressions.Complex
{
    public class ComplexLambdaBinaryExpression : ComplexBinaryExpression
    {
        private readonly Func<ComplexExpression, ComplexExpression, Expression> f_GetRe;
        private readonly Func<ComplexExpression, ComplexExpression, Expression> f_GetIm;

        public ComplexLambdaBinaryExpression(ComplexExpression Left, ComplexExpression Right,
                    Func<ComplexExpression, ComplexExpression, Expression> GetRe, Func<ComplexExpression, ComplexExpression, Expression> GetIm)
                    : base(Left, Right)
        {
            f_GetRe = GetRe;
            f_GetIm = GetIm;
        }

        protected override Expression GetRe() { return f_GetRe(Left, Right); }

        protected override Expression GetIm() { return f_GetIm(Left, Right); }
    }
}